
    <link href="/public/static/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="/public/static/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <link href="/public/static/plugin/AdminLTE/css/AdminLTE.css" rel="stylesheet" type="text/css" />
    <link href="/public/static/plugin/AdminLTE/css/AdminLTE-singular.css" rel="stylesheet" type="text/css" />

    <!-- 基础自定义css -->
    <link href="/public/static/css/normal.css" rel="stylesheet" type="text/css" />
    <link href="/public/static/plugin/jqueryui/jquery.ui.css" rel="stylesheet" type="text/css" />

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="/public/static/js/html5shiv.js"></script>
    <script src="/public/static/js/respond.min.js"></script>
    <![endif]-->

    <!-- add new calendar event modal -->

    <!-- Start  基础脚本1 -->
    <script src="/public/static/js/jquery.min.js"></script>
    <script src="/public/static/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="/public/static/plugin/jqueryui/jquery.ui.js" type="text/javascript"></script>
    <script src="/public/static/plugin/layer/layer.js"></script>
    <!-- End    基础脚本1 -->


<style>
.flexigrid {margin-top: 20px;margin-left: 15px;margin-right: 15px;}
.flexigrid .hDiv {background-color: #F5F5F5; clear: both; border-style: solid none; border-width: 1px 0; border-color: #FFF transparent; position: relative; z-index: 1; overflow: hidden; }
.flexigrid .hDiv th, .flexigrid .bDiv td {
    vertical-align: top !important;
    text-align: left;
    border-left: solid 1px #f5eded;
    border-bottom: solid 1px #f5eded;
    overflow: visible;
    line-height: 35px;
    font-size: 14px;
}
.ch_style{
	padding-left: 15px;
	padding-top: 10px;
	
}
.flexigrid .bDiv { background: #fff; min-height: 300px; position: relative; z-index: 2; overflow: auto; }
.flexigrid .bDiv table { width: 100%; }
.flexigrid .bDiv td { color: #555; vertical-align: top; white-space: nowrap; padding: 0; margin: 0; border-bottom: 1px solid E6E6E6; }
.flexigrid .bDiv a { color: #3b639f; }
.flexigrid .bDiv a:hover { text-decoration: underline; color: #CD0200; }
.flexigrid .bDiv td { vertical-align: top !important; text-align:left; border-left:solid 1px #f5eded;border-bottom:solid 1px #f5eded;overflow: visible; }

.flexigrid div.bDiv tr:hover td { background: #F4FCFA; }

.bot{
	float: right;
    padding: 15px 0;
}

a.ncap-btn-big { text-decoration: none;font: bold 14px/20px "microsoft yahei", arial; color: #FFFFFF; background-color: #5cb85c; text-align: center; vertical-align: middle; display: inline-block; height: 35px; padding: 7px 19px; border: solid 1px #5cb85c; border-radius: 3px; cursor: pointer; }
a:hover.ncap-btn-big { text-decoration: none; color: #FFFFFF; background-color: #5cb85c; box-shadow: 0 0 0 2px rgba(82, 168, 236, 0.15); }


</style>
    <div class="flexigrid">
        <div class="hDiv">
            <div class="hDivBox">
                <table cellspacing="0" cellpadding="0">
                    <thead>
                    <tr>
                        <th abbr="article_title" axis="col3" class="" align="left">
                            <div class="ch_style" style="text-align: left; width: 50px;" class=""><input type="checkbox" class="checkAll"></div>
                        </th>
                        <th abbr="ac_id" axis="col4" class="" align="left">
                            <div style="text-align: center; width: 80px;" class="">ID</div>
                        </th>
                        <th abbr="article_time" axis="col6" class="" align="left">
                            <div style="text-align: center; width: 150px;" class="">渠道名称</div>
                        </th>
                        <th abbr="ac_id" axis="col4" class="" align="left">
                            <div style="text-align: center; width: 150px;" class="">渠道标识</div>
                        </th>
                        <th style="width:100%" axis="col7">
                            <div></div>
                        </th>
                    </tr>
                    </thead>
                </table>
            </div>
        </div>
        
        <div class="bDiv" style="height: auto;">
            <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
                <table>
                    <tbody id="goos_table">
                    <{if count($list) == 0}>
                    <div class="alert alert-warning" style="margin:0;" role="alert">没有渠道可以选择</div>
                    <{/if}>
                    <{foreach from=$list item=item key=key}>
                        <tr>
                            <td class="" align="left">
                                <div class="ch_style" style="text-align: left; width: 50px;">
                                    <input class="checkItem" type="checkbox" name="channel_id[]" data-channel-name="<{$item.channel_name}>" value="<{$item.id}>" />
                                </div>
                            </td>
                            <td class="" align="left">
                                <div style="text-align: center; width: 80px;"><{$item.id}></div>
                            </td>
                            <td class="" align="left">
                                <div style="text-align: center; width: 150px;"><{$item.channel_name}></div>
                            </td>
                            <td class="" align="left">
                                <div style="text-align: center; width: 150px;"><{$item.tab}></div>
                            </td>
                            <td class="" style="width: 100%;" align="">
                                <div>&nbsp;</div>
                            </td>
                        </tr>
                    <{/foreach}>
                    </tbody>
                </table>
            </div>
            
        </div>
        
        <div class="bot"><a onclick="select_channel();" class="ncap-btn-big ncap-btn-green">确认提交</a></div>
    </div>
    
<script>
	    $(document).on("click", '.checkAll', function (e) {
            if($(this).is(':checked')){
                $('.checkItem').each(function(i,o){
                    $(o).attr('checked','checked');
                })
            }else{
                $('.checkItem').each(function(i,o){
                    $(o).removeAttr('checked');
                })
            }
        })
	    

	    
    function select_channel()
    {
        var inputs = $("input[class='checkItem']:checked");
        if (inputs.length == 0) {
            layer.alert('请选择渠道', {icon: 2}); //alert('请选择商品');
            return false;
        }
        var channelArr = new Array();
        inputs.each(function(i,o){
            var id = $(o).val();
            var name = $(o).attr('data-channel-name');
            
            channelItem=new Object();
            channelItem.id=id;
            channelItem.name=name;
            //console.log(channelItem);
            channelArr.push(channelItem);

        })
        if(channelArr.length == 0){
            layer.alert('请至少选择一个渠道');
            return false;
        }
        window.parent.call_back(channelArr);
    }	
    
    
    
</script>

